package com.mofeng.myshop.controller.portal;


import com.mofeng.myshop.service.ICommodityCategoryService;
import com.mofeng.myshop.until.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 商品分类 前端控制器
 * </p>
 *
 * @author MoFeng
 * @since 2024-04-14
 */
@RestController
@RequestMapping("/portal/commodity-category")

@Tag(name = "商品分类接口", description = "商品分类接口")
@RequiredArgsConstructor
public class CommodityCategoryController {

    private final ICommodityCategoryService categoryService;

    @Operation(summary = "查询单个分类信息")
    @GetMapping("/{id}")
    public R getCommodityCategory(@PathVariable("id") String id) {
        return categoryService.getCategory(id);
    }

    @Operation(summary = "所有分类信息")
    @GetMapping("/list")
    public R getCommodityCategoryList(@RequestParam(value = "projectId",required = false) String projectId) {
        return categoryService.getCategoryList(projectId);
    }
}
